<!doctype html>
<html lang="en">
<head>
    <title>Recaf - modern bytecode editor</title>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
	<meta name="description" content="Recaf is a modern java bytecode editor using Objectweb's ASM and JavaFX.">
	<meta name="keywords" content="java,bytecode,editor,recaf,reverse engineering">
	<link rel="icon" type="image/x-icon" href="favicon.ico"/>
    <link rel="stylesheet" href="css/font/roboto300.css">
    <link rel="stylesheet" href="css/pure/pure-min.css">
    <link rel="stylesheet" href="css/pure/grids-responsive-min.css">
    <link rel="stylesheet" href="css/scroll.css">
    <link rel="stylesheet" href="css/common.css">
    <link rel="stylesheet" href="css/menu.css">
    <link rel="stylesheet" href="css/code.css">
    <link rel="stylesheet" href="css/docs.css">
    <link rel="stylesheet" href="css/table.css">
    <script src="js/jquery.min.js"></script>
    <style>
.box {
  border: 1px solid rgb(56, 56, 56);
  background-color: rgba(0, 0, 0, 0.1);
}
.box .head {
  background-color: rgb(150, 150, 150);
  padding: 8px;
  min-height: 38px;
  text-align: center;
  vertical-align: middle;
  font-weight: bold;
}
.box p {
  margin: 10px;
}

/* Used on the workspace page */
#diagram {
  width: 100%;
  display: flex;
  flex-direction: row;
  flex-wrap: wrap;
  justify-content: center;
  align-content: stretch;
  align-items: stretch;
}

#diagram>.box {
  flex: 0 1 23%;
}

@media(max-width: 767px) {
  #diagram {}

  #diagram>.box {
    flex: 0 1 100%;
  }
}
    </style>
</head>
<body id="root">
<header class="pure-menu pure-menu-horizontal">
    <a href="index.html"><div class="logo"></div></a>
    <nav>
        <ul class="pure-menu-list">
            <li class="pure-menu-item pure-menu-selected"><a href="documentation.html" class="pure-menu-link">Documentation</a></li>
            <li class="pure-menu-item"><a href="features.html" class="pure-menu-link">Features</a></li>
            <li class="pure-menu-item"><a href="https://github.com/Col-E/Recaf" class="pure-menu-link">Github</a></li>
        </ul>
    </nav>
</header>
<article>
    <div id="sidebar" class="column">
        <div class="pure-menu">
            <ul class="pure-menu-list">
                <li class="pure-menu-item"><span class="parent-menu">Setup</span>
                    <ul class="pure-menu-sub-list">
                        <li class="pure-menu-item"><a href="doc-setup-get.html" class="pure-menu-link">Getting Recaf</a></li>
                        <li class="pure-menu-item"><a href="doc-setup-8.html" class="pure-menu-link">Java 8</a></li>
                        <li class="pure-menu-item"><a href="doc-setup-11.html" class="pure-menu-link">Java 11+</a></li>
                    </ul>
                </li>
                <li class="pure-menu-item"><span class="parent-menu">Introduction</span>
                    <ul class="pure-menu-sub-list">
                        <li class="pure-menu-item"><a href="doc-intro-workspace.html" class="pure-menu-link">Workspaces</a></li>
                        <li class="pure-menu-item"><a href="doc-intro-config.html" class="pure-menu-link">Config</a></li>
                    </ul>
                </li>
                <li class="pure-menu-item"><span class="parent-menu">Searching</span>
                    <ul class="pure-menu-sub-list">
                        <li class="pure-menu-item"><a href="doc-search-string.html" class="pure-menu-link">Strings</a></li>
                        <li class="pure-menu-item"><a href="doc-search-value.html" class="pure-menu-link">Values</a></li>
                        <li class="pure-menu-item"><a href="doc-search-ref-class.html" class="pure-menu-link">Class references</a></li>
                        <li class="pure-menu-item"><a href="doc-search-ref-member.html" class="pure-menu-link">Member references</a></li>
                        <li class="pure-menu-item"><a href="doc-search-dec-member.html" class="pure-menu-link">Member declarations</a></li>
                        <li class="pure-menu-item"><a href="doc-search-instruction.html" class="pure-menu-link">Instructions</a></li>
                    </ul>
                </li>
                <li class="pure-menu-item"><span class="parent-menu">Editing</span>
                    <ul class="pure-menu-sub-list">
                        <li class="pure-menu-item"><a href="doc-edit-modes.html" class="pure-menu-link">Class modes</a></li>
                        <li class="pure-menu-item"><a href="doc-edit-mode-decompile.html" class="pure-menu-link">Decompile mode</a></li>
                        <li class="pure-menu-item"><a href="doc-edit-mode-table.html" class="pure-menu-link">Table mode</a></li>
                        <li class="pure-menu-item"><a href="doc-edit-mode-hex.html" class="pure-menu-link">Hex mode</a></li>
                        <li class="pure-menu-item"><a href="doc-edit-assembler.html" class="pure-menu-link">Assembler</a></li>
                        <ul class="pure-menu-sub-list">
                            <li class="pure-menu-item"><a href="doc-edit-assembler-errors.html" class="pure-menu-link">Errors</a></li>
                        </ul>
                    </ul>
                </li>
                <li class="pure-menu-item"><span class="parent-menu">Advanced</span>
                    <ul class="pure-menu-sub-list">
                        <li class="pure-menu-item"><a href="doc-advanced-theme.html" class="pure-menu-link">Themes</a></li>
                        <li class="pure-menu-item"><a href="doc-advanced-plugin.html" class="pure-menu-link">Plugins</a></li>
                        <li class="pure-menu-item"><a href="doc-advanced-scripting.html" class="pure-menu-link">Scripting</a></li>
                    </ul>
                </li>
            </ul>
        </div>
    </div>
    <div id="content" class="column">
        <h1 id="workspaces">Workspaces</h1>
        <p>Recaf operates in workspaces. Each workspace can have one or more files loaded at a time. The first file loaded will be marked as the primary resource. All following files are secondary resources. In addition to these two resources, there are two additional back-end resources that add functionality to Recaf.</p>
        <div id="diagram">
            <div class="box">
                <div class="head">Primary Resource</div>
                <ul><li>Classes</li><li>Resources</li></ul>
                <p>A primary resource contains all the class files and resources of the input to be modified.</p>
            </div>
            <div class="box">
                <div class="head">Secondary Resource(s)</div>
                <ul><li>Classes</li><li>Resources</li></ul>
                <p>A secondary resource contains supporting class files and resources. They are for reference purposes and are used to bolster things like ease of navigation, recompilation, and proper stack-frame generation. Multiple secondary resources may exist in a workspace.</p>
            </div>
            <div class="box">
                <div class="head">Classpath Resource</div>
                <ul><li>Classes</li></ul>
                <p>The classpath resource is a hidden resource common to all workspaces. It allows Recaf to read class files directly from memory.</p>
            </div>
            <div class="box">
                <div class="head">Phantom Resource</div>
                <ul><li>Classes</li></ul>
                <p>The phantom resource is used to store temporary class files that are generated to bolster things like recompilation and proper stack-frame generation.</p>
                <p>If the phantom generation process fails, you may have to provide libraries as backing resources to use some features. But overall it should not be too big of a deal.</p>
                <blockquote>
                <p><strong>Note</strong>: This is regenerated each time a new workspace is created and runs in the background until completion.<br> It currently does not handle cases where generated methods belong to method hierarchies that get renamed.</p>
                </blockquote>
            </div>
        </div>
        <p>The primary resource is the file that will be modified. Recaf&#39;s primary functionality <em>(editing, searching, etc)</em> uses only this file. </p>
        <p>Secondary resources may be used as supporting libraries or for reference purposes. Classes in secondary resources are still navigable like those in the primary resource, however they are <em>read-only</em>. They cannot be modified. </p>
        <blockquote>
        <p><strong>Note</strong>: Secondary resources will be used as compiler classpath items when recompiling code in the primary resource.</p>
        </blockquote>
        <p>Supported file types include:</p>
        <ul>
        <li>Class files</li>
        <li>Jar files</li>
        <li>War files</li>
        </ul>
        <blockquote>
        <p><strong>Note</strong>: You can also attach to currently running Java programs by opening the <i>"Attach"</i> menu.</p>
        </blockquote>
        <h2 id="creating-a-workspace">Creating a workspace</h2>
        <p>You can create a new workspace by selecting <em>&quot;File &gt; Load&quot;</em>. This will show a file prompt where you can select the primary resource. Alternatively you can drag-and-drop a file onto the left-most panel. </p>
        <p>Once the workspace is created with the primary resource you can add additional secondary resources with <em>&quot;File &gt; Add library&quot;</em>.</p>
        <center><img src="screenshots/workspace-dropdown.png"></center>
        <p>All resources can have sources and JavaDocs attached as references. Right click on the resource and select which item you would like to attach. After attaching JavaDocs you can hover over a method to show a documentation popup.</p>
        <table class="aligner">
            <tr>
                <td><span class="helper"/><img src="screenshots/workspace-add.png"></td>
                <td><span class="helper"/><img src="screenshots/javadoc.png"></td>
            </tr>
        </table>
        <blockquote>
        <p><strong>Note</strong>: You can supply a file to Recaf to load initially on startup using the command line argument <code>--input &lt;path/to/file&gt;</code></p>
        </blockquote>
        <h2 id="navigating-the-workspace">Navigating the workspace</h2>
        <p>Considering the fact that Recaf supports multiple resources in a workspace there needs to be a way to navigate to the files of each resource. This is done by inserting a dropdown menu at the top of the navigation tree. In this menu the primary resource will be listed at the top and all additional libraries will be added below it. Selecting one of these items will replace the tree with the contents of that file. </p>
        <p>Each resource&#39;s navigation tree is persistent. This means that when a directory is opened it will stay open even after switching to another resource. When you switch back the tree will be just as it was before.</p>
        <p>In order to quickly navigate to files it would be useful for there to be a filter. At the bottom of the navigation tree is a filter box. The content of the filter will show all tree items that contain the given path. For example <code>java/lang/String</code> and <code>String</code> will show the <code>String</code> class in the navigation tree <em>(Along with <code>StringBuilder</code> since it contains <code>String</code>)</em>.</p>
        <center><img src="screenshots/workspace-search.gif"></center>
        <h2 id="saving-a-file">Saving a file</h2>
        <p>As covered in the <a href="doc-edit-modes.html">editing mode documentation</a> changes are first saved locally inside of Recaf when you hit the save keybind <em>(<code>Control + S</code>)</em>. This does not update the actual file on the system. In order to apply the changes you made you need to export the program after saving each change. To do this  select <em>&quot;File &gt; Export program&quot;</em> from the menu bar. This will prompt you to give a file location to save the file to.</p>
        <h2 id="saving-a-workspace">Saving a workspace</h2>
        <p>If you want to save the configured workspace you may use <em>&quot;File &gt; Export workspace&quot;</em>. This will prompt you to give a file location to save the workspace to. This will create a JSON file that holds references to each resource in the workspace. This JSON file can be used when loading a file <em>(from either the menu prompt, or by drag-and-drop)</em> to open all items in the workspace at once.</p>
        <blockquote>
        <p><strong>Note</strong>: Workspaces that use runtime components such as the attach function to connect to live processes cannot be exported to a JSON.</p>
        </blockquote>
        <br id="spacing-hack">
    </div>
</article> 
</body>
</html>
